/**
 * @author Jason Pratt
 * @see edu/cmu/cs/stage3/alice/authoringtool/util/DnDGroupingPanel.java: 
 *      class GroupingPanelDragGestureListener implements java.awt.dnd.DragGestureListener
 *       class DragListener extends java.awt.event.MouseAdapter implements java.awt.event.MouseMotionListener 
 *        void mouseReleased (java.awt.event.MouseEvent ev): dragWindow.setVisible( false );
 *        void mouseDragged (java.awt.event.MouseEvent ev): dragWindow.setVisible(true); dragWindow.setLocation( p );
 *        boolean updateImages (boolean valid): dragWindow.setImage( tileImage );
 * 
 * protected edu.cmu.cs.stage3.alice.authoringtool.util.DragWindow dragWindow;
 * class GroupingPanelDragGestureListener implements java.awt.dnd.DragGestureListener
 *  class DragListener extends java.awt.event.MouseAdapter implements java.awt.event.MouseMotionListener 
 *   void mouseReleased (java.awt.event.MouseEvent ev): dragWindow.setVisible( false );
 *   void mouseDragged (java.awt.event.MouseEvent ev): dragWindow.setVisible(true); dragWindow.setLocation( p );
 *   boolean updateImages (boolean valid): dragWindow.setImage( tileImage );
 * 
 */

package edu.cmu.cs.stage3.alice.authoringtool.util;

import java.awt.Window;

public class DragWindow extends Window {

 protected java.awt.Image image;
 protected int width;
 protected int height;

 //private static int cont=0;

 public DragWindow (java.awt.Frame owner) {
  super( owner );
  //System.out.println("\n\n\nDragWindow.java: -------------------------------------------------"+cont++);
  setLayout( new java.awt.BorderLayout( 0, 0 ) );
  }

 public void setImage (java.awt.Image image) {
  // System.out.println("\nDragWindow.java: setImage(Image): --------------------------------- "+cont++);
  this.image = image;
  if (image != null) {
   setSize( width, height );
   }
  repaint();
  }

 //Rem @Override
 public void paint (java.awt.Graphics g) {
  // System.out.println("\nDragWindow.java: paint(...): --------------------------------- "+cont++);
  g.drawImage( image, 0, 0, this );
  // Def. em: DnDGroupingPanel.java: private boolean updateImages (boolean valid): java.awt.Image tileImage = DnDGroupingPanel.this.getImage();
  }

 }
